/*
 * Created on Oct 4, 2003
 *
 * Mihai Postelnicu
 * 
 */
package ro.gateway.aida.stats;
import java.io.Serializable;
import java.util.Date;
import java.util.Enumeration;
import java.util.Map;

import org.jfree.data.DefaultPieDataset;

import de.laures.cewolf.DatasetProducer;
public class SectorPieChart implements DatasetProducer, Serializable {

	protected StatsHolder sh;
	public SectorPieChart(StatsHolder sh) {
		super();
		this.sh=sh;
	}
	


	public Object produceDataset(Map params) {
		
		DefaultPieDataset ds = new DefaultPieDataset();

			Enumeration en=sh.elements();
			while (en.hasMoreElements()) {
				StatsItem element = (StatsItem) en.nextElement();
				ds.setValue(element.getName().toString(),element.getCount());
			}
			
		
		return ds;
	}

	public String getProducerId() {
		return "PieDataProducer";
	}

	public boolean hasExpired(Map params, Date since) {
		return false;
	}

}
